<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('schedule_records', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('project_id')->index()->comment('所属项目ID');
            $table->unsignedBigInteger('schedule_id')->index()->comment('进度计划ID');
            $table->unsignedBigInteger('push_id')->default(0)->comment('发布人');
            $table->unsignedBigInteger('role_id')->default(0)->comment('责任方');
            $table->unsignedBigInteger('person_id')->default(0)->comment('责任人');
            $table->tinyInteger('type')->index()->comment('1:准时开始，2:推迟开始，3准时完成，4推迟完成');
            $table->unsignedBigInteger('days')->default(0)->comment('变动天数');
            $table->unsignedBigInteger('sums')->default(0)->comment('变动次数');
            $table->date('front_date')->nullable()->comment('变动前日期');
            $table->date('last_date')->nullable()->comment('变动后日期');
            $table->string('delay')->default('/')->comment('推迟原因');
            $table->string('measure')->default('/')->comment('解决措施');
            $table->unsignedBigInteger('harmonize_id')->default(0)->comment('协调人');
            $table->string('harmonize')->default('/')->comment('协调内容');
            $table->tinyInteger('is_review')->default(0)->comment('审核');
            $table->unsignedBigInteger('review_id')->default(0)->comment('审核人ID');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('schedule_records');
    }
};
